package com.atguigu.srb.core.thread;

import lombok.SneakyThrows;

/**
 * @author lupengning
 * @version 1.0
 * @description:
 * @date 2021/6/18 6:08
 */
public class TicketRunnable implements Runnable {

  private int index = 1;


  @SneakyThrows()
  @Override
  public void run() {
    synchronized (this) {
      final int MAX = 50;
      while (index <= MAX) {
        System.out.println(Thread.currentThread().getName() + ":" + (index++));
        Thread.sleep(100);
      }

    }
  }
}
